
<template>
    <div>
        <h2 ref="h2Ref">hello</h2>
    </div>


</template>
<script setup>
import { onBeforeMount, onMounted ,ref} from 'vue';
const h2Ref=ref(null)
onBeforeMount(()=>{
    console.log('组件挂载前',h2Ref.value);
})
onMounted(()=>{
    console.log('组件挂载后',h2Ref.value);
})

</script>


<style lang="css" scoped>

</style>